Yes. It is always good to test programs with values that are right at the limit.
A car rental agency wants a program to implement its rules for who can rent a car. The rules are:
The program looks something like the cookie program:
// Rental Car Checker
//
import java.io.*;
class RenterChecker
{
public static void main (String[] args) throws IOException
{
BufferedReader stdin =
new BufferedReader ( new InputStreamReader( System.in ) );
String inData;
int age, credit;
// get the age of the renter
System.out.println("How old are you?");
inData = stdin.readLine();
age = Integer.parseInt( inData );
// get the credit line
System.out.println("How much credit do you have?");
inData = stdin.readLine();
credit = Integer.parseInt( inData );
// check that both qualifications are met
if ( _______________________ )
System.out.println("Enough to rent this car!" );
else
System.out.println("Have you considered a bicycle?" );
}
}